﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            SqlConnection con = new SqlConnection(@"Data Source=PRIYANUDEEP\PRIYANUDEEP;Initial Catalog=ASPM_Project;Integrated Security=True");
            SqlCommand cmd = new SqlCommand("insert into Tbl_UserDetails(UserName,Password,EmailId,G1Score,G2Score,G3Score,G4Score,G5Score) values ('" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox1.Text + "',0,0,0,0,0)", con);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
            string script = "alert('success')";
            Response.Redirect("HomePage.aspx");
            ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
        }
        catch(Exception ex)
        {
            Response.Write(ex);
        }
        finally
        {
            TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = "";
        }
    }
}